//
//  AVKitViewController.m
//  AVFoundation
//
//  Created by bao on 2018/9/5.
//  Copyright © 2018年 bao. All rights reserved.
//

#import "AVKitViewController.h"

#import <AVKit/AVKit.h>

#define kReadyForDisplay @"readyForDisplay"

@interface AVKitViewController () <AVPlayerViewControllerDelegate>

@end

@implementation AVKitViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
}

- (IBAction)playLocal {
    NSURL *url = [[NSBundle mainBundle] URLForResource:@"hubblecast" withExtension:@"m4v"];
    AVPlayerViewController *playerVC = [[AVPlayerViewController alloc] init];
    AVPlayer *player = [AVPlayer playerWithURL:url];
    playerVC.player = player;
    [player play];
    [self presentViewController:playerVC animated:YES completion:nil];
}

- (IBAction)playRemote {
    NSURL *url = [NSURL URLWithString:@"http://hc.yinyuetai.com/uploads/videos/common/B65B013CF61E82DC9766E8BDEEC8B602.flv?sc=8cafc5714c8a6265"];
    AVPlayerViewController *playerVC = [[AVPlayerViewController alloc] init];
    AVPlayer *player = [AVPlayer playerWithURL:url];
    playerVC.player = player;
    [playerVC.player play];
    [self presentViewController:playerVC animated:YES completion:nil];
}



@end
